const BASE = 'https://sqayczgb.lc-cn-n1-shared.com'
export const $http = (url,method="GET",data={})=>{
    return new Promise((resolve,reject)=>{
        wx.request({
            url: `${BASE}/1.1/${url}`,
            method,
            data,
            header:{
              "X-LC-Id": "sQAYczGbselM16XFl0DPCVL9-gzGzoHsz",
              "X-LC-Key": "4zz4udMEUhHujKseCfeuqbFk",
              "Content-Type": "application/json"
            },
            success:(res)=>{
                resolve(res) //将成功后拿到的数据给到then
            },
            fail:(err)=>{
                reject(err) //将失败后的信息给到 catch
            }
        })
    })
} 

export const $get = (url,data={})=>{
    return $http(url,'GET',data)
}

export const $post = (url,data={})=>{
    return $http(url,'POST',data)
}
